/*
* GeoVISTA Center (Penn State, Dept. of Geography)
* Copyright (c), 2003-2011,  Jin Chen and Alan M. MacEachren, GeoVISTA Center, Penn State University
* All Rights Researved.
*
*
* @author: jin Chen
* @date: Jul 6, 2003$
* @version: 1.0
*/
package edu.psu.geovista.app.pcp.plot.control.tools;

import edu.psu.geovista.app.pcp.animation.DataAnimator;
import edu.psu.geovista.app.pcp.plot.gui.BasicPcpUI;
import edu.psu.geovista.app.pcp.plot.services.CommonService;

public class AnimationTool extends BasicTool{

    DataAnimator animator;
    public AnimationTool(BasicPcpUI ui) {
        super(ui);


    }

    /*******************************************************************************************************
     *                Animation
     *******************************************************************************************************/

    /**
     * Listen to timer and do animation
     * @param e
     */

    public void start() {
        DataAnimator animator=getAnimator() ;
        animator.start() ;
    }
    public void pause() {
        DataAnimator animator=getAnimator() ;
        animator.pause() ;
    }
    public void stop() {
        DataAnimator animator=getAnimator() ;
        animator.stop() ;
    }
    public void step() {
        DataAnimator animator=getAnimator() ;
        animator.step() ;
    }
  /*  private void resetanimation(){ // 
        DataAnimator animator=getAnimator() ;
        animator.step() ;
    }*/

    private  DataAnimator getAnimator() {
        if(animator==null){
             animator=(DataAnimator) this.getService().getServiceComponent(CommonService.Service_Animation );
        }
        return animator;
    }


}
